import axios from 'axios'

export default {
    getAxios(url, data, header) {
        return new Promise((resolve, reject) => {
            axios.get(url, {
                headers: header || {},
                params: data
            }).then(res => {
                resolve(res);
            }).catch(err => {
                reject(err);
            })
        })
    },
    postAxios(url, data, header = {}) {
        return new Promise((resolve, reject) => {
            axios({
                url: url,
                method: 'post',
                data: data,
                headers: header || { 'Content-Type': 'application/x-www-form-urlencoded' }
            }).then(res => {
                resolve(res);
            }).catch(err => {
                reject(err);
            })
        })
    }
}